home *** CD-ROM | disk | FTP | other *** search
- Path: news.informatik.uni-muenchen.de!usenet
- From: Kurt Watzka <watzka@stat.uni-muenchen.de>
- Newsgroups: cs.forum,cuhk.se.3420,comp.lang.c
- Subject: Re: Help: a very segmentation fault!
- Date: Sat, 13 Apr 1996 02:50:01 +0200
- Organization: Institut fⁿr Statistik
- Message-ID: <316EFA39.2A6D@stat.uni-muenchen.de>
- References: <4ki7gu$bgc@eng_ser1.erg.cuhk.hk> <4kinqm$hnt@eng_ser1.erg.cuhk.hk>
- NNTP-Posting-Host: pc4.stat.uni-muenchen.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Fan.. ... ... wrote:
- >
- > I'm a good man (mfchan@cs.cuhk.hk) wrote:
- > > This is really the most strange thing I come across in C programming.
- >
- > > main()
- > > {
- > > char block[82];
- > > fp2 = fopen("fool", "r+b");
-
- If that file does not exist or cannot be accesse for both reading and writing,
- or if something strange happens to the stdio library, fopen() can fail. Using
- a NULL pointer returned from fopen() in calls to other functions that expect
- a FILE pointer might lead to the observed behaviour.
-
- > > writeblock(fp2, 0, OVERFILE, block);
-
- We cannot say much without knowing something about writeblock(). I assume that
- it does something similar to
-
- fwrite(block, sizeof block, 1, fp);
-
-
- > > }
- >
- > > Need your help. Million Thks!
- >
- > I've tried the program... That's okay... except some syntax error...
- >
- > One more thing... What is your platform?? There's no "r+b" mode for
- > fopen on unix systems... Default mode is binary for all files.
-
- There _is_ a "r+b" mode in ANSI C. Whether it does something different from
- "w+" is up to the implementation.
-
- Kurt
-